<template>
  <basic-dialog :visible="isVisible"
                :isShowInnerLoading="isShowInnerLoading"
                min-width="600px"
                :title="dialogTitle">
    <q-form     @submit="submit"
                greedy
                @reset="reset"
                ref="myForm"
                class="dialog-content form-inline block">
      <div class="padding-t-20">
        <div class="row">
          <div class="col padding-r-20">
            <yz-input v-model.trim="dataForm.number" :maxlength="30" title="备件编号" :rules="[0]"></yz-input>
          </div>
          <div class="col">
            <yz-input v-model="dataForm.name" :maxlength="30" :rules="[0]" :title="`备件名称`"></yz-input>
          </div>
        </div>
        <div class="row">
          <div class="col padding-r-20">
            <yz-input
              v-model="dataForm.category"
              inputType="select"
              :options="$attrs.sparePartOptions"
              title="备件类别"
            />
          </div>
          <div class="col">
            <yz-input v-model.trim="dataForm.spec" :maxlength="30" :title="`规格`"></yz-input>
          </div>
        </div>
        <div class="row">
          <div class="col padding-r-20">
            <yz-input
              v-model="dataForm.unit"
              inputType="select"
              :options="$attrs.toolUnitOptions"
              title="单位"
            />
          </div>
          <div class="col">
            <yz-input v-model.trim="dataForm.brand" :title="`品牌`" :maxlength="30"></yz-input>
          </div>
        </div>
        <div class="row">
          <div class="col padding-r-20">
            <yz-input v-model="dataForm.useTo"  :title="`用途`" :maxlength="50"></yz-input>
          </div>
          <div class="col">
            <yz-input v-model.trim="dataForm.price" :title="`单价`" :rules="[0, 15, 16]" ></yz-input>
          </div>
        </div>
        <div class="row">
          <div class="col padding-r-20">
            <yz-input v-model="dataForm.lowerLimit"  :title="`库存下限`" :rules="[0, 15, 3]"></yz-input>
          </div>
          <div class="col">
            <yz-input v-model.trim="dataForm.higherLimit" :title="`库存上限`"></yz-input>
          </div>
        </div>
                <div>
                  <yz-input
                    v-model.trim="dataForm.remark"
                    title="备注"
                    inputType="textarea"
                    :maxlength="100"
                  />
                </div>
      </div>
      <q-separator style="margin-left: -20px;margin-right: -20px;width: calc(100% + 40px)" />
      <div class="dialog-footer text-center margin-t-10">
        <q-btn outline
               label="取消"
               color="primary"
               class="q-mr-md"
               type="reset" />
        <q-btn unelevated
               label="确认"
               v-throttle
               color="primary"
               type="submit" />
      </div>
    </q-form>
  </basic-dialog>
</template>

<script>
import DIALOGMIXIN from 'src/components/basic-mixins/dialog-mixin'
import { getUpdateParts, setSaveParts } from '../../../boot/spare/parts'
export default {
  name: 'add-edit-dialog',
  mixins: [DIALOGMIXIN],
  props: {
  },
  computed: {
  },
  watch: {
  },
  data () {
    return {
      mixinDialgOptions: {
        addURL: setSaveParts, // 提交的URL
        editURL: getUpdateParts, // 提交的URL
        getListUrl: '', // 编辑时候获取详情的url
        getListKey: ['id'], // 获取明细根据默认为id;默认只传入一个参数
        isSetData: false, // 获取的数据是否进去处理 func => setData
        isChangeData: false, // 请求数据是否进去处理 func => changeData
        title: '备件', // 标题内容
        isForm: true // 是否是表单 如果是的默认 ref= myForm
      },
      dataForm: {
        category: '',
        unit: '',
        name: '',
        spec: '',
        number: '',
        brand: '',
        price: '',
        useTo: '',
        lowerLimit: '',
        higherLimit: '',
        remark: ''
      }
    }
  },
  mounted () {
  },
  methods: {
  }
}
</script>

<style scoped lang="scss">
.mold-cur{
    /deep/ .form-inline .q-input .q-field__inner{
      cursor: pointer;
    }
}
</style>
